const mongoose = require("../common/db");

const collect = new mongoose.Schema({
  collectUser: String, // 收藏用户
  collectTime: String, // 收藏时间
  collectGoods: String, // 收藏商品
});

collect.statics.findByUsername = function (name, callback) {
  this.find({ collectUser: name }, callback);
};

collect.statics.findById = function (name, id, callBack) {
  this.findOne({ collectUser: name, collectGoods: id }, callBack);
};

const collectModel = mongoose.model("collect", collect);
module.exports = collectModel;